import pandas as pd

df = pd.read_csv('合并RID.csv', encoding='gbk')

def extrate(colName, val, saveFilename):
    df2 = df[df[colName]==val]
    df2.to_csv(saveFilename)

extrate('TYPE', 'AD', 'AD.csv')